package cn.kevinking.auth.domain;

import cn.kevinking.auth.entity.BfzUser;
import lombok.AllArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;

/**
 * login user object adapting UserDetails
 *
 * @author kevinking
 * @since 13  2025
 */
@AllArgsConstructor
public class LoginUserAdapter implements UserDetails {

	private BfzUser bfzUser;

	@Override
	public Collection<? extends GrantedAuthority> getAuthorities() {
		return List.of();
	}

	@Override
	public String getPassword() {
		return bfzUser.getPassword();
	}

	@Override
	public String getUsername() {
		return bfzUser.getUsername();
	}

	@Override
	public boolean isAccountNonExpired() {
		return false;
	}

	@Override
	public boolean isAccountNonLocked() {
		return false;
	}

	@Override
	public boolean isCredentialsNonExpired() {
		return false;
	}

	@Override
	public boolean isEnabled() {
		return false;
	}

	public String getUid() {
		return bfzUser.getUid();
	}

	public BfzUser getUser() {
		return bfzUser;
	}
}
